import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {UrlService} from '../common/service/url.service';
import {Observable} from 'rxjs';
import {ApiRes} from '../common/model/response';
import {RelatedCondition} from '../model/related-condition';

@Injectable({
  providedIn: 'root'
})
export class RelatedPolicyListService {

  constructor(private http: HttpClient,
              private urlService: UrlService) {
  }

  // 获取相关政策列表
  getRelatedList(condition: RelatedCondition): Observable<ApiRes> {
    const url = this.urlService.getWebUrl('/relatedPolicies/relatedWithRegion');
    // @ts-ignore
    return this.http.get<ApiRes>(url, {params: condition});

  }
  // 获取地域列表
  getRegionList(condition: RelatedCondition): Observable<ApiRes> {
    const url = this.urlService.getWebUrl('/relatedPolicies/relatedRegion');
    // @ts-ignore
    return this.http.get<ApiRes>(url, {params: condition});

  }
}
